package com.shushan.discount.bean;

import com.android.net.bean.NetBaseBean;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * @ClassName: CouponBean
 * @Desciption: //优惠券数据bean
 * @author: zhangshihao
 * @date: 2018-08-30
 */
public class CouponBean extends NetBaseBean {

    public int id;
    public String code;
    public int bid;
    public int recommend_id;
    public int uid;
    public int type;//1、自用劵 2、亲情券
    public int coupon_id;//对应活动id
    public int dlength;//有效期时长
    public double act_date;
    public double end_date;
    public String exp_date;//有效期
    public double create_time;
    public int is_use;//0、激活 1、已激活
    public String coupon_name;
    public int price;
    public String share_url;//分享二维码网址
    public String name;//已经分享的人名

    @Override
    public void initByJson(JSONObject jsonObject) throws JSONException {
        if(jsonObject == null){
            return;
        }
        id = jsonObject.optInt("id",0);
        code = jsonObject.optString("code","");
        bid = jsonObject.optInt("bid",0);
        recommend_id = jsonObject.optInt("recommend_id",0);
        uid = jsonObject.optInt("uid",0);
        type = jsonObject.optInt("type",0);
        coupon_id = jsonObject.optInt("coupon_id",0);
        dlength = jsonObject.optInt("dlength",0);
        act_date = jsonObject.optDouble("act_date",0);
        end_date = jsonObject.optDouble("end_date",0);
        exp_date = jsonObject.optString("exp_date","");
        create_time = jsonObject.optDouble("create_time",0);
        is_use = jsonObject.optInt("is_use",0);
        coupon_name = jsonObject.optString("coupon_name","");
        price = jsonObject.optInt("price",0);
        share_url = jsonObject.optString("share_url","");
        name = jsonObject.optString("name","");
    }
}
